//
//  TopHeaderView.m
//  yunyan
//
//  Created by haichuang on 2018/3/14.
//  Copyright © 2018年 haichuang. All rights reserved.
//

#import "TopHeaderView.h"

@implementation TopHeaderView

- (instancetype)init {
    self = [super init];
    
    if (self != nil) {
        [self initTopView];
        
    }
    
    return self;
}

-(void)initTopView{
    WeakSelf;
    self.backgroundColor = [UIColor whiteColor];
    _headImage = [[UIImageView alloc] init];
    [self addSubview:_headImage];
    [_headImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo (weakSelf).offset (14.0f);
        make.height.width.equalTo (@(40.0f));
    }];
    _headImage.layer.masksToBounds = YES;
    _headImage.layer.cornerRadius = 20.0f;
    _headImage.image = [UIImage imageNamed:@"jjlin.jpg"];;
    
    
    _titleLabel = [[UILabel alloc] init];
    [self addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo (_headImage);
        make.left.equalTo (_headImage.mas_right).offset (9.0f);
    }];
    _titleLabel.textColor = RGBA(51, 51, 51, 1);
    _titleLabel.font = [UIFont systemFontOfSize:18.0f];
    _titleLabel.text = USER_DEFAULTGet(@"act_user");
    
    _timeLabel = [[UILabel alloc] init];
    [self addSubview:_timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo (_headImage);
        make.right.equalTo (weakSelf.mas_right).offset (-20.0f);
    }];
    _timeLabel.textColor = RGBA(153, 153, 153, 1);
    _timeLabel.font = [UIFont systemFontOfSize:12.0f];
    _timeLabel.text = USER_DEFAULTGet(@"act_time");
}

@end
